package cn.su.service.impl;

import cn.su.dao.UserDao;
import cn.su.dao.impl.UserDaoimpl;
import cn.su.pojo.User;
import cn.su.pojo.fenye;
import cn.su.pojo.role;
import cn.su.service.UserService;

import java.util.List;

public class Userserviceimpl implements UserService {
   //登录
    @Override
    public User Login(String name, String password) {
        UserDao userdao=new UserDaoimpl();
        User user = userdao.Login(name, password);
        return user;
    }
    //修改
    @Override
    public int xiugai(String oldpass, String newpass) {
        UserDao userdao=new UserDaoimpl();
      int i = userdao.xiugai(oldpass, newpass);
        return i;
    }
    //用户列表
    public List<User> User_list(fenye fenye){
        UserDao userdao=new UserDaoimpl();
        List<User> users = userdao.User_list(fenye);
        return users;
    }
    //角色列表
    @Override
    public List<role> role_list() {
        UserDao userdao=new UserDaoimpl();
        List<role> roles = userdao.role_list();
        return roles;
    }
    //用户搜索
    @Override
    public List<User> USer_search(String name, String juese) {
        UserDao userdao=new UserDaoimpl();
        List<User> users = userdao.USer_search(name, juese);
        return users;
    }
    //用户添加
    @Override
    public int User_add(User user) {
        UserDao userdao=new UserDaoimpl();
        int i = userdao.User_add(user);
        return i;
    }

    public  User User_chakan(int id){
        UserDao userdao=new UserDaoimpl();
        User user = userdao.User_chakan(id);
        return user;
    }
    public  int User_update(int id,User user){
        UserDao userdao=new UserDaoimpl();
        int i = userdao.User_update(id, user);
        return i;
    }
    public  int User_delete(int id){
        UserDao userdao=new UserDaoimpl();
        int i = userdao.User_delete(id);
        return i;
    }
    public  int  User_count(){
        UserDao userdao=new UserDaoimpl();
        int i = userdao.User_count();
        return i;
    }
}
